# 基础镜像
FROM debian:latest

# 更新软件包并安装必要的软件
RUN apt-get update && apt-get install -y \
    libfreetype6-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    libonig-dev \
    libzip-dev \
    zip \
    unzip \
    nginx \
    php-fpm \
    php-cli \
    php-mysql \
    php-redis \
    mysql-client \ 
    redis-tools \
    curl \
    wget \
    supervisor \
    rsync \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* \
    # 安装 nginxUI
    wget https://github.com/schenkd/nginx-ui/releases/latest/download/nginx-ui-linux-amd64 -O /usr/local/bin/nginxui && \
    chmod +x /usr/local/bin/nginxui \
    # 创建 Supervisor 配置文件夹
    mkdir -p /etc/supervisor/conf.d \
    # 创建 nginxUI 配置文件夹
    mkdir -p /etc/nginxui

# 添加 Supervisor 配置文件
COPY supervisord.conf /etc/supervisor/supervisord.conf

# 添加启动脚本
COPY start.sh /start.sh

RUN chmod +x /start.sh

# 暴露必要的端口
EXPOSE 80 8080

# 设置启动命令
CMD ["/start.sh"]
